<?php

namespace Modules\Edu\Policies;

use App\Models\Site;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
use Modules\Edu\Entities\Topic;

class TopicPolicy
{
    use HandlesAuthorization;

    public function before($user, $ability, $site = null)
    {

        if (is_admin()) {


            return true;
        }

    }

    public function viewAny(User $user)
    {


    }

    public function view(User $user)
    {


    }

    public function create(User $user)
    {

    }

    public function update(User $user, Topic $topic)
    {

        return $user->id === $topic['user_id'] || is_admin();
    }

    public function delete(User $user, Topic $topic)
    {
        return $user->id === $topic['user_id'] || is_admin();
    }

}
